let AdBannerControll = require('../common/AdBannerControll');
let BannerMoveCasual = require('../common/BannerMoveCasual');
cc.Class({
  extends: cc.Component,
  ctor() {
    this.isTutorialMode = false;
  },
  
  onLoad() {
  
  },
  
  onEnable() {
    cc.CEventManager.instance.dispatchEvent(EVENTS.SCENE_LOADED, this);
    cc.CEventManager.instance.registerEvent(EVENTS.TUTORIAL_ALL_STEP_COMPLETED, this, 0, "onTutorialAllCompleted");
  },
  
  onDisable() {
    cc.CEventManager.instance.dispatchEvent(EVENTS.SCENE_DESTROYED, this);
    cc.CEventManager.instance.releaseAllEvents(this);
  },
  
  
  setTutorialMode(isTutorialMode) {
    this.isTutorialMode = isTutorialMode;
  },
  onTutorialAllCompleted() {
    this.setTutorialMode(false);
  },
  
  changePageView(pageViewName) {
    cc.CEventManager.instance.dispatchEvent(EVENTS.CHANGE_TO_PAGE_VIEW, pageViewName);
  },
  
  changeToHomeView() {
    this.changePageView('home');
  },
  
  setClientData(data) {
    this.clientData = data;
  },
  
  getClientData() {
    return this.clientData;
  },
  
  onPageOpen() {
  
  },
  
  onPageClose() {
    this.hideBanner();
  },
  showBanner(show) {
    let adBannerControll = this.node.getComponent(AdBannerControll);
    if (adBannerControll) {
      adBannerControll.enabled = show;
    }
  },
  
  hideBanner(){
    this.showBanner(false);
  }
});
